﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/App.Master" Inherits="System.Web.Mvc.ViewPage<OrnamentMemberShipSetting>" %>

<%@ Import Namespace="Ornament.MVCWebFrame.Areas.MemberShips.Models" %>

<%@ Import Namespace="Qi" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MembershipSetting
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% Html.EnableClientValidation(); %> 
    <form id="form1" class="cssform" method="post" action="<%=Url.Action("SaveMembershipSetting") %>">
    <%= Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") %>
    <input type="submit" value="保存" />
    <p>
        <%= Html.LabelFor(model => model.ApplicationName) %>
        <%= Html.TextBoxFor(model => model.ApplicationName) %>
        <%= Html.ValidationMessageFor(model => model.ApplicationName) %>
    </p>
    <p>
        <%= Html.LabelFor(model => model.EnablePasswordReset)%>
        <%=Html.CheckBoxFor(model=>Model.EnablePasswordReset)%>
    </p>
    <p>
        <%= Html.LabelFor(model => model.MinRequiredPasswordLength)%>
        <%=Html.TextBox("minRequiredNonAlphanumericCharacters",Model.MinRequiredPasswordLength)%>
    </p>
    <p>
        <%=Html.LabelFor(model=>model.MinRequiredPasswordLength) %>
        <%=Html.TextBox("minRequiredPasswordLength",Model.MinRequiredPasswordLength)%>
    </p>
    <p>
        <%=Html.LabelFor(model => model.PasswordAttemptWindow)%>
        <%=Html.TextBox("passwordAttemptWindow",Model.PasswordAttemptWindow)%>
    </p>
    <p>
        <label for="passwordFormat">
            Password Format
        </label>
        <%
            var select = from s in EnumHelper.GetObjects<MembershipPasswordFormat>()
                         select new SelectListItem() { Text = s.ToString(), Value = Convert.ToInt32(s).ToString(), Selected = Model.PasswordFormat.ToString() == s.ToString() }; %>
        <%=Html.DropDownList("passwordFormat", select)%>
    </p>
    <p>
        <%=Html.LabelFor(model => model.PasswordStrengthRegularExpression)%>
        <%=Html.TextBox("passwordStrengthRegularExpression",Model.PasswordStrengthRegularExpression)%>
    </p>
    <p>
        <%=Html.LabelFor(model => model.RequiresQuestionAndAnswer)%>
        <%=Html.CheckBox("requiresQuestionAndAnswer",Model.RequiresQuestionAndAnswer)%>
    </p>
    <p>
        <%=Html.LabelFor(model => model.RequiresUniqueEmail)%>
        <%=Html.CheckBox("requiresUniqueEmail",Model.RequiresUniqueEmail)%>
    </p>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .cssform label
        {
            width: 150px;
        }
    </style>

    

    <script src="../../../../Scripts/jquery.validate.min.js" type="text/javascript"></script>

    

    <script type="text/javascript" language="javascript">
        var passwordFormat = <%=Convert.ToInt32(Model.PasswordFormat) %>;
        var passwordFormatText="<%=Model.PasswordFormat.ToString()%>";
        $(document).ready(function() {
            $("#passwordFormat").val(passwordFormat).change(function() {
                if(passwordFormat == <%=Convert.ToInt32(MembershipPasswordFormat.Hashed)%> ){
                    alert("Hash是单向解密,一旦设定无法更改其他密码形式");
                }
            });
        });
    </script>

</asp:Content>
